<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>探究定位</title>
    <link rel="stylesheet" href="../style/all.css">
    <link rel="stylesheet" href="../style/index.css">
    <link rel="stylesheet" href="../style/caidanlan.css">
    <link rel="icon" href="../image/touxiang.jpg">
    <link rel="stylesheet" href="../style/定位.css">
    <link rel="stylesheet" href="../style/cssshuxingjicheng.css">
</head>

<body>
    <header class="caidanlan">
        <nav style="background-color: black;">
            <div class="hleft" style="height: 0px;">
                <img src="../image/touxiang.jpg" alt="">
            </div>
            <div class="hright">
                <a href="https://gitee.com/tian158/task" target="_blank">点击打开仓库</a>
                <div id="bkon" class="bk">
                    <div class="block"></div>
                    <div class="block"></div>
                    <div class="block"></div>
                </div>
            </div>
            <div class="hidbox">
                <div class="container">
                    <div class="square" style="--d: 1"></div>
                    <div class="square" style="--d: 2"></div>
                    <div class="square" style="--d: 3"></div>
                    <div class="square" style="--d: 4"></div>
                    <div class="square" style="--d: 5"></div>
                    <div class="square" style="--d: 6"></div>
                    <div class="square" style="--d: 7"></div>
                    <div class="square" style="--d: 8"></div>
                    <div class="square" style="--d: 9"></div>
                </div>
                <div class="hidboxspan menu" style="display: none;">
                    <ul>
                        <li style="--clr:#fff">
                            <a href="./动感立方体.html" data-text="&nbsp;返回">&nbsp;返回&nbsp;</a>
                        </li>
                        <li style="--clr:#fff">
                            <a href="../index.html" data-text="&nbsp;主页">&nbsp;主页&nbsp;</a>
                        </li>
                        <li style="--clr:#fff">
                            <a href="./21circle.html" data-text="&nbsp;display改变显示类型">&nbsp;display改变显示类型&nbsp;</a>
                        </li>
                        <li style="--clr:#fff">
                            <a href="./探究浮动.html" data-text="&nbsp;探究浮动">&nbsp;探究浮动&nbsp;</a>
                        </li>
                        <li style="--clr:#fff">
                            <a href="./探究定位.html" data-text="&nbsp;探究定位">&nbsp;探究定位&nbsp;</a>
                        </li>
                        <li style="--clr:#fff">
                            <a href="./促销图示.html" data-text="&nbsp;促销图示">&nbsp;促销图示&nbsp;</a>
                        </li>
                    </ul>
                </div>
            </div>
        </nav>
    </header>
    <div class="inherit" style="height: 70px;"></div>

    <h1 class="inherit">position:static;默认值，静态，即常规流下的定位</h1>
    <section class="container">
        <div style="display: flex;border: 3px dashed  red;">
            <div class="static">static</div>
            <div class="static">static</div>
            <div class="static">static</div>
            <div class="static">static</div>
        </div>
    </section>
    <h1 class="inherit">position:relative;该关键字下，元素先放置在未添加定位时的位置，再在不改变页面布局的前提下调整元素位置（因此会在此元素未添加定位时所在位置留下空白）</h1>
    <section class="container">
        <div style="display: flex;border: 3px dashed  red;">
            <div class="static">static</div>
            <div class="relative" style="right: 50px;">relative</div>
            <div class="relative" style="top: 50px;">relative</div>
            <div class="relative" style="bottom: 50px;">relative</div>
            <div class="relative" style="left: 50px;">relative</div>
            <div class="static">static</div>
        </div>
    </section>
    <h1 class="inherit">position:absolute;元素会被移出正常文档流，并不为元素预留空间，通过指定元素相对于最近的非 static 定位祖先元素的偏移，来确定元素位置。绝对定位的元素可以设置外边距（margins），且不会与其他边距合并</h1>
    <section class="container" style="position: relative;">
        <div style="display: flex;border: 3px dashed  red;">
            <div class="static">static</div>
            <div class="absolute" style="right: 50px;">absolute</div>
            <div class="absolute" style="top: 50px;">absolute</div>
            <div class="absolute" style="bottom: 50px;">absolute</div>
            <div class="absolute" style="left: 50px;">absolute</div>
            <div class="static">static</div>
        </div>
    </section>
    <h1 class="inherit">position:fixed;元素会被移出正常文档流，并不为元素预留空间，而是通过指定元素相对于屏幕视口（viewport）的位置来指定元素位置。元素的位置在屏幕滚动时不会改变。打印时，元素会出现在的每页的固定位置。fixed 属性会创建新的层叠上下文。当元素祖先的 transform、perspective、filter 或 backdrop-filter 属性非 none 时，容器由视口改为该祖先</h1>
    <section class="container" style="position: relative;">
        <div style="display: flex;border: 3px dashed  red;">
            <div class="static">static</div>
            <div class="fixed" style="right: 50px; top: 50px;">fixed</div>
            <div class="fixed" style="top: 50px; left: 50px;">fixed</div>
            <div class="fixed" style="bottom: 50px;  right: 50px;">fixed</div>
            <div class="fixed" style="left: 50px; bottom: 50px;">fixed</div>
            <div class="static">static</div>
        </div>
    </section>
</body>
<script src="../js/anim.js"></script>

</html>